using Clancy.Interfaces;
using System;
using System.Reactive.Subjects;

namespace Clancy.Data
{
    public class OnlineSurveilanceStatus : IOnlineSurveilanceStatus
    {
        private readonly BehaviorSubject<ISurveilanceResultFrame> m_CurrentProcessedFrame = new BehaviorSubject<ISurveilanceResultFrame>(null);
        private readonly BehaviorSubject<bool> m_RecordingStatus = new BehaviorSubject<bool>(false);
        private readonly ISurveilanceObject m_SurveilanceObject;

        public OnlineSurveilanceStatus(ISurveilanceObject surveilanceObject)
        {
            m_SurveilanceObject = surveilanceObject;
        }

        public IObservable<ISurveilanceResultFrame> CurrentProcessedFrame
        {
            get { return m_CurrentProcessedFrame; }
        }

        public IObservable<bool> RecordingStatus
        {
            get { return m_RecordingStatus; }
        }

        public ISurveilanceObject SurveilanceObject { get { return m_SurveilanceObject; } }

        public void SetCurrentProcessedFrame(ISurveilanceResultFrame frame)
        {
            m_CurrentProcessedFrame.OnNext(frame);
        }
    }
}